package com.htg.util;

public class UtilLegend{

    /**
     * 根据图斑类型 获取对应图例的颜色
     * @param type
     * @return
     */
    public static String getColr(String type){
        //String temp = eliminateUpperCaseLetters(type);
        String temp = type;
        switch (temp){
            case "2":
                return "#A599C9";
            case "3":
                return "#F1A43B";
            case "4":
                return "#637ED6";
            case "11":
                return "#60BFD6";
            case "12":
                return "#D5619F";
            case "13":
                return "#D0DD47";
            case "A":

                return "#843900";
        }
        return "#000000";
    }


    /**
     * 根据图斑类型编号，返回类型名字
     * @param type
     * @return
     */
    public static String getName(String type){
        //String temp = eliminateUpperCaseLetters(type);
        String temp = type;
        switch (temp){
            case "2":
                return "新增光伏用地";
            case "3":
                return "新增高尔夫球场";
            case "4":
                return "新增库塘";
            case "11":
                return "新增线形地物";
            case "12":
                return "新增建（构）筑物";
            case "13":
                return "新增推填土";
            case "A":

                return "建设用地翻建";
        }
        return "未知";
    }


    /**
     * 去除字符串中的大写字母
     * @param str
     * @return
     */
    public static String eliminateUpperCaseLetters(String str){
        String temp = str;
        char lastChar = (temp.charAt(temp.length()-1));
        while(!(lastChar>=48&&lastChar<=57)){
            temp = temp.substring(0,temp.length()-1);
            lastChar = (temp.charAt(temp.length()-1));
        }
        return temp;
    }


}
